<template>
	<page-meta :page-style="'overflow:'+(popShow?'hidden':'visible')"></page-meta>
	<headassy title="修改工单" :isSearch="false" :isTab="false"></headassy>
	<view class="addorder" :style="'min-height: calc(100vh - ' + (parseInt(system.safeArea.top) + 44) + 'px)'">
		<view class="addorder-content">
			<!-- 填写联系信息 -->
			<view class="addorder-content-item">
				<p class="addorder-item-title text-orange fsize14">第一步：填写联系信息*</p>
				<view class="pd-tb40">
					<u--form labelPosition="left" ref="uForm">
						<u-form-item label="选择客户" labelWidth="200" @click="show2=true">
							<u--input inputAlign="right" border="none" disabled disabledColor="#ffffff"></u--input>
							<u-icon slot="right" name="arrow-right"></u-icon>
						</u-form-item>
						<u-form-item label="联系姓名" labelWidth="200">
							<u--input inputAlign="right" border="none" v-model="workUser.name"></u--input>
							<u-icon slot="right" color="transparent" name="arrow-right"></u-icon>
						</u-form-item>
						<u-form-item label="联系电话" labelWidth="200">
							<u--input inputAlign="right" border="none" v-model="workUser.phone"></u--input>
							<u-icon slot="right" color="transparent" name="arrow-right"></u-icon>
						</u-form-item>
						<u-form-item label="联系地区" labelWidth="200">
							<!-- <u--input inputAlign="right" border="none" v-model="workUser.address"></u--input> -->
							<!-- <pick-regions></pick-regions> -->
							<view @click="addressShow=true">
								<span style="text-align: right;" v-show="!workUser.address" class="text-orange" :style="{ color: color || '' }">选择</span>
								<span style="text-align: right;" class="address-color" v-show="workUser.address">{{ workUser.address }}</span>
							</view>
							<u-icon slot="right" color="transparent" name="arrow-right"></u-icon>
						</u-form-item>
						<u-form-item label="详细地址" labelWidth="200">
							<u--input inputAlign="right" border="none" v-model="workUser.detailAddress"></u--input>
							<u-icon slot="right" color="transparent" name="arrow-right"></u-icon>
						</u-form-item>
					</u--form>
				</view>
			</view>
			<!-- 填写工单内容 -->
			<view class="addorder-content-item">
				<p class="addorder-item-title text-orange fsize14">第二步：填写工单内容*</p>
				<view class="pd-tb40">
					<u--form labelPosition="left" ref="uForm">
						<u-form-item label="工单分类" labelWidth="200" @click="show3=true">
							<u--input inputAlign="right" border="none" disabled disabledColor="#ffffff" v-model="order2.type"></u--input>
							<u-icon slot="right" name="arrow-right"></u-icon>
						</u-form-item>
						<u-form-item label="处理方式" labelWidth="200" @click="show4=true">
							<u--input inputAlign="right" border="none" disabled disabledColor="#ffffff" v-model="order2.clfstype"></u--input>
							<u-icon slot="right" name="arrow-right"></u-icon>
						</u-form-item>
						<u-form-item label="故障描述" labelWidth="200">
							<u--textarea autoHeight="true" placeholder="请用文字描述工单问题" border="none" v-model="order.content"></u--textarea>
						</u-form-item>
						<u-form-item label="上传图片" labelWidth="200">
							<u-upload style="height: 74px;width: 74px;" :fileList="fileList1" @afterRead="afterRead"
								@delete="deletePic" name="1" multiple :maxCount="10" width="74px" height="74px"></u-upload>
						</u-form-item>
					</u--form>
				</view>
			</view>
			<!-- 确认工单产品 -->
			<view class="addorder-content-item" v-for="(item,index) in list2" :key="index" style="border-bottom: 1px solid #f5f5f5;">
				<p class="addorder-item-title text-orange fsize14">第三步：确认工单产品*</p>
				<view class="pd-tb40 product u-flex">
					<view class="img">
						<img src="https://sso.xcyunfu.com/xiaocheng/product/200720/704307.jpg" alt="" />
					</view>
					<view class="" style="flex: 1 1 0%;">
						<p class="fsize14">{{item.model}}</p>
						<p class="text-gray fsize14">机身编码：无</p>
						<p class="text-gray fsize14">仓储编码：</p>
					</view>
					<view class="u-flex-center">
						<view class="remove-btn" @click="remove(index)">
							移除
						</view>
					</view>
				</view>
			</view>
			<!-- 添加更多产品、录入或扫描编码 -->
			<view class="u-flex-between" style="background-color: #f5f5f5;">
				<view class="addproduct text-orange" @click="addproduct">
					添加更多产品
				</view>
				<view class="addproduct text-orange">
					录入或扫描编码
				</view>
			</view>
			<!-- 填写附加信息 -->
			<view class="addorder-content-item">
				<p class="addorder-item-title text-orange fsize14">第四步:填写附加信息</p>
				<view class="pd-tb40">
					<u--form labelPosition="left" ref="uForm">
						<u-form-item label="短信通知" labelWidth="200">
						<!-- 	<u-radio-group v-model="noteDx" placement="row" @change="groupChange">
								<u-radio v-for="(item, index) in radiolist1" :key="index" labelSize="14px" size="20px"
									iconSize="16px" :label="item.name" :name="item.name" @change="radioChange" class="mr-5">
								</u-radio>
							</u-radio-group> -->
							<u--input inputAlign="right" border="none" disabled disabledColor="#ffffff" v-model="dxtz"></u--input>
							<u-icon slot="right" name="arrow-right" @click="show12=true"></u-icon>
						</u-form-item>
						<u-form-item label="受理方式" labelWidth="200" @click="show5=true">
							<u--input inputAlign="right" border="none" disabled disabledColor="#ffffff" v-model="order2.accept"></u--input>
							<u-icon slot="right" name="arrow-right"></u-icon>
						</u-form-item>
						<u-form-item label="服务级别" labelWidth="200" @click="show6=true">
							<u--input inputAlign="right" border="none" disabled disabledColor="#ffffff"
								v-model="order2.serviceLevel"></u--input>
							<u-icon slot="right" name="arrow-right"></u-icon>
						</u-form-item>
						<u-form-item label="下单时间" labelWidth="200" @click="show7=true">
							<u--input inputAlign="right" border="none" disabled disabledColor="#ffffff" v-model="order2.createDate"></u--input>
							<u-icon slot="right" name="arrow-right"></u-icon>
						</u-form-item>
					</u--form>
				</view>
			</view>
			<!-- 填写受理信息 -->
			<view class="addorder-content-item">
				<p class="addorder-item-title text-orange fsize14">第五步:填写受理信息</p>
				<view class="pd-tb40">
					<u--form labelPosition="left" ref="uForm">
						<u-form-item label="质保状态" labelWidth="200">
							<!-- <u-radio-group v-model="radiovalue1" placement="row" @change="groupChange">
								<u-radio v-for="(item, index) in radiolist2" :key="index" labelSize="14px" size="20px"
									iconSize="16px" :label="item.name" :name="item.name" @change="radioChange" class="mr-5">
								</u-radio>
							</u-radio-group> -->
							<u--input inputAlign="right" border="none" disabled disabledColor="#ffffff" v-model="zbType"></u--input>
							<u-icon slot="right" name="arrow-right" @click="show11=true"></u-icon>
						</u-form-item>
						<u-form-item label="受理客服" labelWidth="200" @click="show9=true">
							<u--input inputAlign="right" border="none" disabled disabledColor="#ffffff" v-model="order2.kfname"></u--input>
							<u-icon slot="right" name="arrow-right"></u-icon>
						</u-form-item>
						<u-form-item label="受理网点" labelWidth="200" @click="show8=true">
							<u--input inputAlign="right" border="none" disabled disabledColor="#ffffff" v-model="order2.network"></u--input>
							<u-icon slot="right" name="arrow-right"></u-icon>
						</u-form-item>
						<u-form-item label="受理备注" labelWidth="200">
							<u--textarea placeholder="请填写受理备注" border="none" v-model="order.remark"></u--textarea>
						</u-form-item>
						<u-form-item label="向客户隐藏受理备注" labelWidth="400">
							<u-radio-group v-model="isMobileRemark" placement="row" @change="groupChange" >
								<u-radio v-for="(item, index) in radiolist3" :key="index" labelSize="14px" size="20px"
									iconSize="16px" :label="item.name" :name="item.name" @change="radioChange" activeColor="#fd7400">
								</u-radio>
							</u-radio-group>
						</u-form-item>
					</u--form>
				</view>
			</view>
			<!-- 附加信息 -->
			<view class="addorder-content-item mb20">
				<p class="addorder-item-title text-orange fsize14">附加信息</p>
				<view class="pd-tb40">
					<u--form labelPosition="left" ref="uForm" v-for="item in zdylist" :key="item.id">
						<u-form-item :label="item.name" labelWidth="200" v-if="item.fieldType==='文本'">
							<u--input inputAlign="right" border="none" v-model="item.fieldValue"></u--input>
						</u-form-item>
						<u-form-item :label="item.name" labelWidth="200" v-else-if="item.fieldType==='多图'">
							<u-upload style="height: 74px;width: 74px;" :fileList="filelist_zdy" @afterRead="afterRead_zdy"
								@delete="deletePic_zdy" name="1" multiple :maxCount="10" width="74px"
								height="74px"></u-upload>
						</u-form-item>
						<u-form-item :label="item.name" labelWidth="200" v-else-if="item.fieldType==='单选'">
							<u-radio-group placement="row" v-model="item.fieldValue">
								<u-radio v-for="(item1,index1) in item.content.value" :key="index1" :label="item1"
									labelSize="14px" size="20px" iconSize="16px" @change="changeOnecheck" :name="item1" activeColor='#fd7400'>
								</u-radio>
							</u-radio-group>
						</u-form-item>
						<u-form-item :label="item.name" labelWidth="200" v-else-if="item.fieldType==='多选'">
							<u-checkbox-group placement="row" v-model="item.fieldValueArr">
								<u-checkbox v-for="(item1,index1) in item.content.value" :key="index1" :label="item1"
									labelSize="14px" iconSize="16px" size="20px" :name="item1" shape="circle" activeColor='#fd7400'>
								</u-checkbox>
							</u-checkbox-group>
						</u-form-item>
					</u--form>
				</view>
			</view>
			<view class="pd10">
				<button class="save-btn" iconColor="#fd7400" style="" @click="saveorder">提 交 工 单</button>
			</view>
		</view>
		<!--  -->
		<view class="">
			<u-popup :show="show" mode="bottom" @close="close">
				<view style="">
					<view class="u-flex-between" style="align-items: center;padding: 10px;">
						<p class="text-gray">选择产品</p>
						<view class="">
							<u-search shape="square" height="56rpx" searchIconSize="22px"
								:showAction="false"></u-search>
						</view>
					</view>
					<view class="" style="border: 1px solid #f5f5f5;">
						<u-tabs :list="list1" @click="click" :current="tabIndex" :itemStyle="{height:'32px'}"
							lineColor="#fd7400" lineWidth="30px" lineHeight="2px"></u-tabs>
						<view class="" style="max-height: 500rpx;overflow-y: auto;height: calc(-82px + 60vh)">
							<view class="mt-5" v-if="tabIndex===0">
								<view class="list-item" v-for="item in brandlist" :key="item.id"
									@click="selectbrand(item)">
									{{item.text}}
								</view>
							</view>
							<view class="mt-5" style="max-height: 500rpx;overflow-y: auto;" v-else-if="tabIndex===1">
								<view class="list-item" v-for="item in sortlist" @click="selectsorts(item)">
									{{item}}
								</view>
							</view>
							<view class="mt-5" style="max-height: 500rpx;overflow-y: auto;" v-else-if="tabIndex===2">
								<view class="list-item" v-for="item in modellist" @click="selectspec(item)">
									{{item.text}}
								</view>
							</view>
							<view class="mt-5" style="max-height: 500rpx;overflow-y: auto;" v-else-if="tabIndex===3">
								<view class="list-item" v-for="item in speclist" @click="changeModelnum(item)">
									{{item.text}}
								</view>
							</view>
						</view>
					</view>
				</view>
			</u-popup>
		</view>
		<!-- 选择客户 -->
		<!-- <view class="">
			<u-popup :show="show2" mode="bottom" @close="show2=false">
				<view style="">
					<view class="u-flex-between" style="align-items: center;padding: 10px;">
						<p class="text-gray">选择客户</p>
						<view class="">
							<u-search shape="square" height="56rpx" searchIconSize="22px" @search="searchcustom"
								v-model="val" :showAction="false"></u-search>
						</view>
					</view>
					<view class="" style="border: 1px solid #f5f5f5;">
						<view class="" style="max-height: 500rpx;overflow-y: auto;height: calc(-82px + 60vh)">
							<view class="mt-5" v-if="tabIndex===0">
								<view class="list-item" v-for="item in customlist" :key="item.id"
									@click="getcustom(item)">
									{{item.title}}
								</view>
							</view>
						</view>
					</view>
				</view>
			</u-popup>
		</view> -->
		<!-- 工单分类 -->
		<!-- <view class="">
			<u-picker :show="show3" ref="uPicker" :columns="columns" @confirm="confirm" keyName="title"
				@change="changeHandler" @close="show3=false" :closeOnClickOverlay="true"
				confirmColor="#fd7400"></u-picker>
		</view> -->
		<!-- 处理方式 -->
	<!-- 	<view class="">
			<u-picker :show="show4" ref="uPicker" :columns="clfslist" keyName="title" @close="show4=false"
				@confirm="confirm2" :closeOnClickOverlay="true" @change="changeHandler2" confirmColor="#fd7400">
			</u-picker>
		</view> -->
		<!-- 受理方式 -->
		<!-- <view class="">
			<u-picker :show="show5" ref="uPicker" :columns="acceptancelist" keyName="title" :closeOnClickOverlay="true"
				@confirm="confirm3" @change="changeHandler3" @close="show5=false" confirmColor="#fd7400"></u-picker>
		</view> -->
		<!-- 服务级别 -->
	<!-- 	<view class="">
			<u-picker :show="show6" ref="uPicker" :columns="fwjblist" keyName="title" :closeOnClickOverlay="true"
				@confirm="confirm4" @change="changeHandler4" @close="show6=false" confirmColor="#fd7400"></u-picker>
		</view> -->
		<!-- 下单时间 -->
		<view>
			<u-datetime-picker :show="show7" mode="datetime" @close="show7=false" @confirm="confirm5" v-model="value1"
				confirmColor="#fd7400" :closeOnClickOverlay="true"></u-datetime-picker>
		</view>
		<!-- 受理网点 -->
		<!-- <view class="">
			<u-picker :show="show8" ref="uPicker" :columns="networklist" keyName="nameVal" :closeOnClickOverlay="true"
				@close="show8=false" @confirm="confirm6" confirmColor="#fd7400"></u-picker>
		</view> -->
		<!-- 受理客服 -->
		<!-- <view class="">
			<u-picker :show="show9" ref="uPicker" :columns="emplist" keyName="title" :closeOnClickOverlay="true"
				@confirm="confirm7" @close="show9=false" confirmColor="#fd7400"></u-picker>
		</view> -->
		<!-- 省市区弹窗 -->
		<u-popup :show="addressShow" @close="addressClose" @open="addressOpen">
			<view style="width:100vw;height:300px;margin-left:-1px;background-color:#fff;" class="bg-white">
				<select-addr :names="addrnames" @selectAddr="selectAddr"></select-addr>
			</view>
		</u-popup>
		<u-popup :show="show2" @close="show2=false" :round="20" mode="bottom">
			<view class="popup-v">
				<view class="popup-header">
					<view class="close u-flex" @click="show2=false" style="">
						<u-icon name="close"></u-icon>
					</view>
					<view class="title">
						选择客户
					</view>
				</view>
				<view class="popup-c">
					<view class="edit-form">
						<view class="u-flex form-item">
							<view class="">
								搜索客户
							</view>
							<view class="u-flex" >
								<!-- <u-search shape="square" height="56rpx" searchIconSize="22px" @search="searchcustom"
									v-model="val" :showAction="false"></u-search> -->
									<input type="text" v-model="val" @blur="searchcustom" />
								<view class="u-flex">
									<u-icon name="search" size="44"></u-icon>
								</view>
							</view>
						</view>
					</view>
					<scroll-view :scroll-y="true" style="max-height: 100vh;">
						<view class="bm-list" style="padding: 0 30rpx;height: 100%;">
							<view class="" v-for="(item,index) in customlist" style="padding: 30rpx;">
								<view class="u-flex-between" @click="getcustom(item,index)" :class="{isActive2:currindex===index}">
									{{item.title}}
								<!-- 	<u-icon name="checkbox-mark" color="#fd7400" size="28" v-if=""></u-icon> -->
								</view>
							</view>
						</view>
					</scroll-view>
					<view class="footer u-flex">
						<view class="">
							<u-button :customStyle="cancelBtn" @click="show2=false">取消</u-button>
						</view>
						<view>
							<u-button type="primary" :customStyle="orangeBtn" @click="saveCustom">
								确 认
							</u-button>
						</view>
					</view>
				</view>
			</view>
		</u-popup>
		<u-popup :show="show3" @close="show3=false" :round="20" mode="bottom">
			<view class="popup-v" style="height: calc(60vh - env(safe-area-inset-bottom));">
				<view class="popup-header">
					<view class="close u-flex" @click="show3=false" style="">
						<u-icon name="close"></u-icon>
					</view>
					<view class="title">
						选择工单分类
					</view>
				</view>
				<view class="popup-c">
					<view class="edit-form">
						<view class="u-flex form-item">
							<view class="">
								选择一级分类
							</view>
							<view class="u-flex" @click="oneCategorizeShow=true">
								<view class="text-gray">
									{{cateorize.oneCategorize}}
								</view>

							</view>
						</view>
						<view class="u-flex form-item">
							<view class="">
								选择二级分类
							</view>
							<view class="u-flex" @click="twoCategorizeShow=true">
								<view class="text-gray">
									{{cateorize.twoCategorize}}
								</view>

							</view>
						</view>
					</view>
					<scroll-view :scroll-y="true" style="max-height: 40vh;">

					</scroll-view>
					<view class="footer u-flex">
						<view class="">
							<u-button :customStyle="cancelBtn" @click="show3=false">取消</u-button>
						</view>
						<view>
							<u-button type="primary" :customStyle="orangeBtn" @click="confirm">
								确 认
							</u-button>
						</view>
					</view>
				</view>
			</view>
		</u-popup>
		<u-popup :show="oneCategorizeShow" @close="oneCategorizeShow=false" :round="20" mode="bottom">
			<view class="popup-v" style="height: calc(60vh - env(safe-area-inset-bottom));">
				<view class="popup-header">
					<view class="close u-flex" @click="oneCategorizeShow=false" style="">
						<u-icon name="close"></u-icon>
					</view>
					<view class="title">
						一级分类
					</view>
				</view>
				<view class="popup-c">

					<scroll-view :scroll-y="true" style="max-height: 40vh;">
						<view class="bm-list" style="padding: 0 30rpx;height: 100%;overflow: auto;">
							<view class="" v-for="(item,index) in defultcol" style="padding: 30rpx;">
								<view class="" @click="selectOne(item,index)" :class="{isActive2:currindex2===index}">
									{{item.title}}
								</view>
							</view>
						</view>
					</scroll-view>
					<view class="footer u-flex">
						<view class="">
							<u-button :customStyle="cancelBtn" @click="oneCategorizeShow=false">取消</u-button>
						</view>
						<view>
							<u-button type="primary" :customStyle="orangeBtn" @click="oneCategorizeShow=false">
								确 认
							</u-button>
						</view>
					</view>
				</view>
			</view>
		</u-popup>
		<u-popup :show="twoCategorizeShow" @close="twoCategorizeShow=false" :round="20" mode="bottom">
			<view class="popup-v" style="height: calc(60vh - env(safe-area-inset-bottom));">
				<view class="popup-header">
					<view class="close u-flex" @click="twoCategorizeShow=false" style="">
						<u-icon name="close"></u-icon>
					</view>
					<view class="title">
						二级分类
					</view>
				</view>
				<view class="popup-c">
					<scroll-view :scroll-y="true" style="max-height: 40vh;">
						<view class="bm-list" style="padding: 0 30rpx;height: 100%;overflow: auto;">
							<view class="" v-for="(item,index) in columnData" style="padding: 30rpx;">
								<view class="" @click="selectTwo(item,index)" :class="{isActive2:currindex3===index}">
									{{item.title}}
								</view>
							</view>
						</view>
					</scroll-view>
					<view class="footer u-flex">
						<view class="">
							<u-button :customStyle="cancelBtn" @click="twoCategorizeShow=false">取消</u-button>
						</view>
						<view>
							<u-button type="primary" :customStyle="orangeBtn" @click="twoCategorizeShow=false">
								确 认
							</u-button>
						</view>
					</view>
				</view>
			</view>
		</u-popup>
		<u-popup :show="show4" @close="show4=false" :round="20" mode="bottom">
			<view class="popup-v" style="height: calc(60vh - env(safe-area-inset-bottom));">
				<view class="popup-header">
					<view class="close u-flex" @click="show4=false" style="">
						<u-icon name="close"></u-icon>
					</view>
					<view class="title">
						选择处理方式
					</view>
				</view>
				<view class="popup-c">
					<view class="edit-form">
						<view class="u-flex form-item">
							<view class="">
								选择一级处理方式
							</view>
							<view class="u-flex" @click="oneClfsShow=true">
								<view class="text-gray">
									{{clfs.oneClfs}}
								</view>

							</view>
						</view>
						<view class="u-flex form-item">
							<view class="">
								选择二级处理方式
							</view>
							<view class="u-flex" @click="twoClfsShow=true">
								<view class="text-gray">
									{{clfs.twoClfs}}
								</view>

							</view>
						</view>
					</view>
					<scroll-view :scroll-y="true" style="max-height: 40vh;">

					</scroll-view>
					<view class="footer u-flex">
						<view class="">
							<u-button :customStyle="cancelBtn" @click="show4=false">取消</u-button>
						</view>
						<view>
							<u-button type="primary" :customStyle="orangeBtn" @click="confirm2">
								确 认
							</u-button>
						</view>
					</view>
				</view>
			</view>
		</u-popup>
		<u-popup :show="oneClfsShow" @close="oneClfsShow=false" :round="20" mode="bottom">
			<view class="popup-v" style="height: calc(60vh - env(safe-area-inset-bottom));">
				<view class="popup-header">
					<view class="close u-flex" @click="oneClfsShow=false" style="">
						<u-icon name="close"></u-icon>
					</view>
					<view class="title">
						一级处理方式
					</view>
				</view>
				<view class="popup-c">

					<scroll-view :scroll-y="true" style="max-height: 40vh;">
						<view class="bm-list" style="padding: 0 30rpx;height: 100%;overflow: auto;">
							<view class="" v-for="(item,index) in clfschildlist" style="padding: 30rpx;">
								<view class="" @click="selectOneClfs(item,index)" :class="{isActive2:currindex4===index}">
									{{item.title}}
								</view>
							</view>
						</view>
					</scroll-view>
					<view class="footer u-flex">
						<view class="">
							<u-button :customStyle="cancelBtn" @click="oneClfsShow=false">取消</u-button>
						</view>
						<view>
							<u-button type="primary" :customStyle="orangeBtn" @click="saveClfs">
								确 认
							</u-button>
						</view>
					</view>
				</view>
			</view>
		</u-popup>
		<u-popup :show="twoClfsShow" @close="twoClfsShow=false" :round="20" mode="bottom">
			<view class="popup-v" style="height: calc(60vh - env(safe-area-inset-bottom));">
				<view class="popup-header">
					<view class="close u-flex" @click="twoClfsShow=false" style="">
						<u-icon name="close"></u-icon>
					</view>
					<view class="title">
						二级处理方式
					</view>
				</view>
				<view class="popup-c">

					<scroll-view :scroll-y="true" style="max-height: 40vh;">
						<view class="bm-list" style="padding: 0 30rpx;height: 100%;overflow: auto;">
							<view class="" v-for="(item,index) in clfschildlist2" style="padding: 30rpx;">
								<view class="" @click="selectTwoClfs(item,index)" :class="{isActive2:currindex4===index}">
									{{item.title}}
								</view>
							</view>
						</view>
					</scroll-view>
					<view class="footer u-flex">
						<view class="">
							<u-button :customStyle="cancelBtn" @click="twoClfsShow=false">取消</u-button>
						</view>
						<view>
							<u-button type="primary" :customStyle="orangeBtn" @click="saveClfs2">
								确 认
							</u-button>
						</view>
					</view>
				</view>
			</view>
		</u-popup>
		<u-popup :show="show5" @close="show5=false" :round="20" mode="bottom">
			<view class="popup-v" style="height: calc(60vh - env(safe-area-inset-bottom));">
				<view class="popup-header">
					<view class="close u-flex" @click="show5=false" style="">
						<u-icon name="close"></u-icon>
					</view>
					<view class="title">
						选择受理方式
					</view>
				</view>
				<view class="popup-c">
					<scroll-view :scroll-y="true" style="max-height: 40vh;">
						<view class="bm-list" style="padding: 0 30rpx;height: 100%;overflow: auto;">
							<view class="" v-for="(item,index) in acceptancelist" style="padding: 30rpx;">
								<view class="" @click="selectSlfs(item,index)" :class="{isActive2:currindex5===index}">
									{{item.title}}
								</view>
							</view>
						</view>
					</scroll-view>
					<view class="footer u-flex">
						<view class="">
							<u-button :customStyle="cancelBtn" @click="show5=false">取消</u-button>
						</view>
						<view>
							<u-button type="primary" :customStyle="orangeBtn" @click="confirm3">
								确 认
							</u-button>
						</view>
					</view>
				</view>
			</view>
		</u-popup>
		<u-popup :show="show11" @close="show11=false" :round="20" mode="bottom">
			<view class="popup-v" style="height: calc(60vh - env(safe-area-inset-bottom));">
				<view class="popup-header">
					<view class="close u-flex" @click="show11=false" style="">
						<u-icon name="close"></u-icon>
					</view>
					<view class="title">
						选择质保状态
					</view>
				</view>
				<view class="popup-c">
					<scroll-view :scroll-y="true" style="max-height: 40vh;">
						<view class="bm-list" style="padding: 0 30rpx;height: 100%;overflow: auto;">
							<view class="" v-for="(item,index) in zbZtList" style="padding: 30rpx;">
								<view class="" @click="selectzbType(item,index)" :class="{isActive2:currindex10===index}">
									{{item.name}}
								</view>
							</view>
						</view>
					</scroll-view>
					<view class="footer u-flex">
						<view class="">
							<u-button :customStyle="cancelBtn" @click="show11=false">取消</u-button>
						</view>
						<view>
							<u-button type="primary" :customStyle="orangeBtn" @click="show11=false">
								确 认
							</u-button>
						</view>
					</view>
				</view>
			</view>
		</u-popup>
		<u-popup :show="show12" @close="show12=false" :round="20" mode="bottom">
			<view class="popup-v" style="height: calc(60vh - env(safe-area-inset-bottom));">
				<view class="popup-header">
					<view class="close u-flex" @click="show12=false" style="">
						<u-icon name="close"></u-icon>
					</view>
					<view class="title">
						短信通知
					</view>
				</view>
				<view class="popup-c">
					<scroll-view :scroll-y="true" style="max-height: 40vh;">
						<view class="bm-list" style="padding: 0 30rpx;height: 100%;overflow: auto;">
							<view class="" v-for="(item,index) in mesList" style="padding: 30rpx;">
								<view class="" @click="selectMesType(item,index)" :class="{isActive2:currindex10===index}">
									{{item.name}}
								</view>
							</view>
						</view>
					</scroll-view>
					<view class="footer u-flex">
						<view class="">
							<u-button :customStyle="cancelBtn" @click="show12=false">取消</u-button>
						</view>
						<view>
							<u-button type="primary" :customStyle="orangeBtn" @click="show12=false">
								确 认
							</u-button>
						</view>
					</view>
				</view>
			</view>
		</u-popup>
		<u-popup :show="show6" @close="show6=false" :round="20" mode="bottom">
			<view class="popup-v" style="height: calc(60vh - env(safe-area-inset-bottom));">
				<view class="popup-header">
					<view class="close u-flex" @click="show6=false" style="">
						<u-icon name="close"></u-icon>
					</view>
					<view class="title">
						选择服务级别
					</view>
				</view>
				<view class="popup-c">
					<scroll-view :scroll-y="true" style="max-height: 40vh;">
						<view class="bm-list" style="padding: 0 30rpx;height: 100%;overflow: auto;">
							<view class="" v-for="(item,index) in fwjblist" style="padding: 30rpx;">
								<view class="" @click="selectFwjb(item,index)" :class="{isActive2:currindex6===index}">
									{{item.title}}
								</view>
							</view>
						</view>
					</scroll-view>
					<view class="footer u-flex">
						<view class="">
							<u-button :customStyle="cancelBtn" @click="show6=false">取消</u-button>
						</view>
						<view>
							<u-button type="primary" :customStyle="orangeBtn" @click="confirm4">
								确 认
							</u-button>
						</view>
					</view>
				</view>
			</view>
		</u-popup>
		<u-popup :show="show9" @close="show9=false" :round="20" mode="bottom">
			<view class="popup-v" style="height: calc(60vh - env(safe-area-inset-bottom));">
				<view class="popup-header">
					<view class="close u-flex" @click="show9=false" style="">
						<u-icon name="close"></u-icon>
					</view>
					<view class="title">
						选择受理客服
					</view>
				</view>
				<view class="popup-c">
					<scroll-view :scroll-y="true" style="max-height: 40vh;">
						<view class="bm-list" style="padding: 0 30rpx;height: 100%;overflow: auto;">
							<view class="" v-for="(item,index) in emplist" style="padding: 30rpx;">
								<view class="" @click="selectSlkf(item,index)" :class="{isActive2:currindex7===index}">
									{{item.title}}
								</view>
							</view>
						</view>
					</scroll-view>
					<view class="footer u-flex">
						<view class="">
							<u-button :customStyle="cancelBtn" @click="show9=false">取消</u-button>
						</view>
						<view>
							<u-button type="primary" :customStyle="orangeBtn" @click="confirm7">
								确 认
							</u-button>
						</view>
					</view>
				</view>
			</view>
		</u-popup>
		<u-popup :show="show8" @close="show8=false" :round="20" mode="bottom">
			<view class="popup-v" style="height: calc(60vh - env(safe-area-inset-bottom));">
				<view class="popup-header">
					<view class="close u-flex" @click="show8=false" style="">
						<u-icon name="close"></u-icon>
					</view>
					<view class="title">
						选择受理网点
					</view>
				</view>
				<view class="popup-c">
					<scroll-view :scroll-y="true" style="max-height: 40vh;">
						<view class="bm-list" style="padding: 0 30rpx;height: 100%;overflow: auto;">
							<view class="" v-for="(item,index) in networklist" style="padding: 30rpx;">
								<view class="" @click="selectSlwd(item,index)" :class="{isActive2:currindex8===index}"> 
									{{item.nameVal}}
								</view>
							</view>
						</view>
					</scroll-view>
					<view class="footer u-flex">
						<view class="">
							<u-button :customStyle="cancelBtn" @click="show8=false">取消</u-button>
						</view>
						<view>
							<u-button type="primary" :customStyle="orangeBtn" @click="confirm6">
								确 认
							</u-button>
						</view>
					</view>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import SelectAddr from '@/pagesA/pages/components/selectAddr';
	export default {
		components: {
			SelectAddr
			
		},
		data() {
			return {
				custAccId: '',
				show: false,
				show2: false,
				show3: false,
				show4: false,
				show5: false,
				show6: false,
				show7: false,
				show8: false,
				show9: false,
				show10: false,
				show11:false,
				show12:false,
				oneCategorizeShow: false,
				twoCategorizeShow: false,
				oneClfsShow: false,
				twoClfsShow: false,
				cateorize: {
					oneCategorize: '选择一级分类',
					oneId: '',
					twoCategorize: '选择二级分类',
					twoId: ''
				},
				clfs: {
					oneClfs: '选择一级处理方式',
					oneId: '',
					twoClfs: '选择二级处理方式',
					twoId: ''
				},
				value1: Number(new Date()),
				list1: [{
					name: '品牌',
				}, {
					name: '分类',
				}, {
					name: '型号'
				}, {
					name: '规格'
				}],
				addrnames: ['省份', '城市', '县/区', '城镇'],
				tabIndex: 0,
				brandlist: [],
				sortlist: [],
				modellist: [],
				speclist: [],
				brandname: '',
				brandId: '',
				sortname: '',
				modelname: '',
				list2: [],
				fileList1: [],
				zdylist: [],
				zdyimglist: [],
				customlist: [],
				workUser: {
					workId: '',
					custAccId: '',
					name: '',
					phone: '',
					// address: '云南省-昆明市-晋宁区--123123'
					address: '',
					detailAddress: ''
				},
				order: {
					id: '',
					custAccId: '',
					typeOneId: '',
					typeTwoId: '',
					methodOneId: '',
					methodTwoId: '',
					serviceLevel: '',
					accept: '',
					createDate: '',
					remark: '',
					content: '',
					acceptServiceId: '',
					moduleId: '',
					networkId: '',
				},
				order2: {
					type: '',
					clfstype: '',
					content: '',
					accept: '',
					serviceLevel: '',
					createDate: '',
					kfname: '',
					network: '',
				},
				color: '', //跳转过来的背景颜色
				val: '',
				defultcol: [],
				columns: [],
				fwjb:'',
				columnData: [
					// ['深圳', '厦门', '上海', '拉萨'],
					// ['得州', '华盛顿', '纽约', '阿拉斯加']
				],
				columnData2: [
					// ['深圳', '厦门', '上海', '拉萨'],
					// ['得州', '华盛顿', '纽约', '阿拉斯加']
				],
				addressShow: false, //选择联系地址
				zbZtList:[{
					name:'在保'
				},{
					name:'过保'
				}],
				zbType:'',
				radiolist1: [{
						name: '是',
						disabled: false
					},
					{
						name: '否',
						disabled: false
					}
				],
				radiolist2: [{
						name: '在保',
						disabled: false
					},
					{
						name: '过保',
						disabled: false
					},

				],
				noteDx: '',
				radiolist3: [{
					name: '是',
					disabled: false
				}],
				clfslist: [],
				radiovalue1: '是',
				acceptancelist: [],
				fwjblist: [],
				type: 1, //受理网点type
				networklist: [],
				emplist: [],
				ordercateId: '', //工单分类选中的id
				clfschildlist: '',
				clfschildlist2: '',
				parentid: '', //处理方式选中的id
				products: [],
				userAddressArr: [], //选择地区的数组格式
				submitproArr: [], //最终提交的产品数组
				filelist_zdy: [], //自定义部分 上传图片
				isMobileRemark: '是', //是否勾选隐藏受理备注
				orangeBtn: {
					height: '50px !important',
					// boxShadow: '0 7px 40px rgba(235 151 43 / 30%)',
					background: '#fd7400',
					border: '0',
					boxShadow: '0px 7px 40px  rgba(253, 112, 8, 0.2)',
					borderRadius: '8px',
					fontSize: '18px',
					width: '200px'
				},
				cancelBtn: {
					height: '50px !important',
					border: '0',
					borderRadius: '8px',
					fontSize: '18px',
					width: '120px',
					color: 'red',
					backGround: '#fff'
				},
				customMes: {
					name: '',
					phone: '',
					id: ''
				},
				mesList:[{
					name:'是'
				},{
					name:'否'
				}],
				accept:'',
				slkf:'',
				slkfId:'',
				slwd:'',
				slwdId:'',
				currindex:-1,
				currindex2:-1,
				currindex3:-1,
				currindex4:-1,
				currindex5:-1,
				currindex6:-1,
				currindex7:-1,
				currindex8:-1,
				currindex9:-1,
				currindex10:-1,
				dxtz:'',
				productsData: {
					// "custAccId": this.custAccId,
					"custAccId": '',
					"type": 3, //1: 已登记,  2： 未登记,  3：临时,  4: 已存在工单的编码
					"codeId": "",
					"productId": "",
					// "product": this.sortname, //产品型号
					"product": '', //产品型号
					"code": "",
					// "brand": this.brandname, //品牌
					"brand": '', //品牌
					// "brandId": this.brandId, //品牌id
					"brandId": '', //品牌id
					"purchaseTime": "", //购买时间
					// "name":this.workUser.name, //姓名
					"name": '', //姓名
					"phone": '', //手机
					"address": '', //地址
					"specifica": '', //规格
					"proSpec": '', //proSpec规格id
					"procust": "",
					"userAddress": "", //地址信息 （JSON 格式） 
					"produtInfo": {
						"id": "",
						"text": '',
						"zjProBrand": '',
						"zjId": '',
						"zjProModel": '',
						"zjTypeName": '',
						"zjProItemNumber": '',
						"brandId": '',
						"spec": null,
						"skuCode": null,
						"name": null,
						"phone": null,
						"privince": null,
						"city": null,
						"area": null,
						"town": null,
						"address": null,
						"batchId": null,
						"batchInfoId": null,
						"qty": null,
						"codeStatus": null
					}
				},
				
				moduleId: '',
				workId: '',
				acId: '',
				
				system: uni.getSystemInfoSync(),
				popShow: false,			// 禁止穿透
			};
		},
		onLoad(e) {
			this.moduleId = e.moduleId;
			this.workId = e.workId;
			this.acId = uni.getStorageSync('acId');
			this.getPullRefresh()
		},
		// 下拉刷新
		onPullDownRefresh() {
			this.getPullRefresh()
		},
		methods: {
			// 下拉刷新请求数据
			getPullRefresh(){
				console.clear()
				this.getorderdetail2();
				this.custAccId = uni.getStorageSync('custAccid')
				this.findbrand()
				this.findModuleFieldByModuleId()
				this.finduserphone()
				this.findworkType()
				this.findclfs()
				this.acceptance()
				this.serviceliver()
				this.findnetworklist()
				this.findemp()
				
				setTimeout(()=>{
					uni.stopPullDownRefresh()
				}, 2000)
			},
			// 获取工单数据
			async getorderdetail2() {
				const res = await uni.$api.work.getorderdetail2({
					id: this.workId,
					acId: this.acId
				})
				console.log('获取工单详情2---', res);
				// 初始化数据
				// 联系信息
				this.workUser.name = res.data.workUserInfo.userName ? res.data.workUserInfo.userName : '';
				this.workUser.phone = res.data.workUserInfo.userPhone ? res.data.workUserInfo.userPhone : '';
				// .accept.split('-')
				this.workUser.detailAddress = res.data.workUserInfo.userAddr ? res.data.workUserInfo.userAddr : '';
				// 工单内容
				this.order2.type = res.data.workUserInfo.typeName1 ? (res.data.workUserInfo.typeName1 + (res.data.workUserInfo.typeName2 ? ('-' + res.data.workUserInfo.typeName2) : '')) : '';
				this.order2.clfstype = res.data.workUserInfo.prossName1 ? (res.data.workUserInfo.prossName1 + (res.data.workUserInfo.prossName2 ? ('-' + res.data.workUserInfo.prossName2) : '')) : '';
				this.order.content = res.data.zjWorkorder.content ? res.data.zjWorkorder.content : '';
				this.fileList1 = res.data.annex.map(imgVal => {
						imgVal.url = imgVal.annex;
						imgVal.thumb = imgVal.annex;
						imgVal.type = "image";
					return imgVal
				});
				
				// 附件信息
				// this.dxtz = ;
				this.order2.accept = res.data.zjWorkorder.accept;
				this.order2.serviceLevel = res.data.zjWorkorder.serviceLevel;
				this.order2.createDate = res.data.zjWorkorder.createDate;
				
				// 受理信息
				this.zbType = this.radiolist2[res.data.workUserInfo.warrantyStatus].name;
				this.order2.kfname = res.data.workUserInfo.netEmp;
				this.order2.network = res.data.workUserInfo.netName;
				this.order.remark = res.data.zjWorkorder.remark;
			},
			
			addproduct() {
				this.show = true
				this.tabIndex = 0
			},
			click(item) {
				console.log('item', item)
				this.tabIndex = item.index

			},
			close() {
				this.show = false
			},
			remove(index) {
				console.log(index)
				this.list2.splice(index, 1)
				this.submitproArr.splice(index, 1)
			},
			radioChange(n) {
				console.log('radioChange', n)
			},
			groupChange(n) {
				console.log('groupChange', n)
			},
			// 自定义单选框
			changeOnecheck(n) {
				console.log('自定义单选框', n)
			},
			addressOpen() {

			},
			addressClose() {
				this.addressShow = false;
			},
			// 选择地址
			selectAddr(value) {
				console.log('选择地址', value)
				let address = {
					province: value[0],
					city: value[1],
					area: value[2],

				}
				this.addressShow = false;
				this.userAddressArr = value;
				this.workUser.address = value.join('-');
				this.workUser.detailAddress = value.join('-');
			},
			// 查询自定义字段
			async findModuleFieldByModuleId() {
				const res = await uni.$api.work.findModuleFieldByModuleId({
					workModuleId: this.moduleId
				})
				console.log(res, '查询自定义字段')
				this.zdylist = res.data
				console.log(this.zdylist, 'this.zdylist')
				console.log(this.zdylist, JSON.stringify(this.zdylist.content))
				this.zdylist.forEach(v => {
					if (v.content !== undefined) {
						console.log('循环每一项', v.content)
						v.content = JSON.parse(v.content)[0]
						v.fieldValue = null
						v.fieldValueArr = []
						if (v.content.value) {
							// console.log('循环val',v.content.value)
							v.content.value = v.content.value.split(',')
						}

						// let val=JSON.parse((v.content.value));
						// if(val.length>0){
						// 	v.content.value = val.split(',')
						// }
					}
				})
				console.log('处理后的zdylist', this.zdylist)
			},
			// 上传图片
			async afterRead(event) {
				// 当设置 multiple 为 true 时, file 为数组格式，否则为对象格式
				let lists = [].concat(event.file)
				console.log(lists)
				// let fileListLen = this.fileList1.length
				lists.map((item) => {
					this.fileList1.push({
						...item,
					})
				})
				// for (let i = 0; i < lists.length; i++) {
				// 	console.log('图片item', lists[i])
				// 	const result = await this.handleuploadimg(lists[i])
				// 	let item = this.fileList1[fileListLen]
				// 	this.fileList1.splice(fileListLen, 1, Object.assign(item, {
				// 		status: 'success',
				// 		message: '',
				// 		url: result
				// 	}))
				// 	console.log(this.fileList1)
				// 	fileListLen++
				// }
			},
			// 自定义图片上传fieldValueArr
			async afterRead_zdy(event) {
				// 当设置 multiple 为 true 时, file 为数组格式，否则为对象格式
				let lists = [].concat(event.file)
				let fileListLen = this.filelist_zdy.length
				lists.map((item) => {
					this.filelist_zdy.push({
						...item,
					})
				})
				for (let i = 0; i < lists.length; i++) {
					console.log('图片item', lists[i])
					const result = await this.handleuploadimg(lists[i])
					let item = this.filelist_zdy[fileListLen]
					this.filelist_zdy.splice(fileListLen, 1, Object.assign(item, {
						status: 'success',
						message: '',
						url: result
					}))
					fileListLen++
				}
			},
			// 自定义图片删除
			deletePic_zdy(event) {
				this.filelist_zdy.splice(event.index, 1)
				this.zdyimglist.splice(event.index, 1)
			},
			deletePic(event) {
				this[`fileList${event.name}`].splice(event.index, 1)
			},
			// 上传图片接口
			async handleuploadimg(file) {
				// custAccId:this.custAccId
				const res = await uni.$api.work.uploadimg(this.custAccId, {
					filePath: file.url
				})
				// console.log('上传后得到的图片',res.data)
				this.zdyimglist.push(res.data)

			},
			async findbrand() {
				const res = await uni.$api.work.findbrand({
					custAccId: this.custAccId
				})
				console.log(res, '品牌列表')
				this.brandlist = res.data
			},
			// 选择品牌
			selectbrand(item) {
				console.log(item, '当前选择品牌数据')
				this.productsData.brand = item.text;
				this.productsData.brandId = item.id;
				this.productsData.userAddress = JSON.stringify()
				this.productsData.produtInfo.zjProBrand = item.text; //品牌
				this.brandname = item.text
				this.brandId = item.id;
				this.products.push({
					brand: item.text,
					brandId: item.id,

				})
				this.selectsort(item)
			},
			selectsorts(item) {
				console.log(item, '点击分类')
				this.productsData.produtInfo.zjTypeName = item; //分类名称
				this.selectmodel(item)
			},
			selectSlkf(item,index){
				console.log(item)
				this.slkfId=item.id
				this.slkf=item.title
				this.currindex7=index
			},
			// 查询分类
			async selectsort(name) {
				// console.log(name, 'name')
				const res = await uni.$api.work.findsort({
					custAccId: this.custAccId,
					brand: this.brandname,
					proType: ''
				})
				console.log(res)
				this.tabIndex = 1
				this.sortlist = res.data
				// this.selectmodel()
			},
			// 查询型号
			async selectmodel(name) {
				// console.log(name, 'name')
				this.sortname = name
				const res = await uni.$api.work.findmodel({
					custAccId: this.custAccId,
					brand: this.brandname,
					proType: this.sortname
				})
				// this.products.push({
				// 	product: item.text,

				// })
				console.log(this.products)
				this.modellist = res.data
				// console.log(this.modellist)
				this.tabIndex = 2
				// this.findspec()
			},
			// 选择型号
			selectspec(item) {
				console.log(item, '选中型号')
				this.productsData.produtInfo.zjId = item.zjId;
				this.productsData.produtInfo.zjProModel = item.text;
				this.productsData.produtInfo.zjProItemNumber = item.zjProItemNumber; //型号

				this.findspec(item)
				this.list2.push({
					model: item.text
				})
				console.log(this.list2, 'list2')
				// this.show = false

			},
			// 查询规格
			async findspec(item) {
				// 这个是型号
				// this.sortname=name
				const res = await uni.$api.work.findspec({
					custAccId: this.custAccId,
					proId: item.zjId
				})
				this.speclist = res.data
				// console.log(this.speclist)
				this.tabIndex = 3


			},
			resetProductData() {
				this.productsData = {
					"custAccId": '',
					"type": null, //1: 已登记,  2： 未登记,  3：临时,  4: 已存在工单的编码
					"codeId": "",
					"productId": "",
					// "product": this.sortname, //产品型号
					"product": '', //产品型号
					"code": "",
					// "brand": this.brandname, //品牌
					"brand": '', //品牌
					// "brandId": this.brandId, //品牌id
					"brandId": '', //品牌id
					"purchaseTime": "", //购买时间
					// "name":this.workUser.name, //姓名
					"name": '', //姓名
					"phone": '', //手机
					"address": '', //地址
					"specifica": '', //规格
					"proSpec": '', //proSpec规格id
					"procust": "",
					"userAddress": "", //地址信息 （JSON 格式） 
					"produtInfo": {
						"id": "",
						"text": '',
						"zjProBrand": '',
						"zjId": '',
						"zjProModel": '',
						"zjTypeName": '',
						"zjProItemNumber": '',
						"brandId": '',
						"spec": null,
						"skuCode": null,
						"name": null,
						"phone": null,
						"privince": null,
						"city": null,
						"area": null,
						"town": null,
						"address": null,
						"batchId": null,
						"batchInfoId": null,
						"qty": null,
						"codeStatus": null
					}
				}
			},
			// 选择规格
			changeModelnum(item) {
				console.log(item, '选择规格')
				console.log('this.workUser.address', JSON.stringify(this.workUser.address))
				//拼接数据格式
				this.productsData.specifica = item.text; //规格名称
				this.productsData.proSpec = "[{'enable':0,'image':'','warranty':'360','price':'0','sku':'PPCP071'}]"
				this.productsData.produtInfo.text = this.productsData.produtInfo.zjProModel;
				let str = this.productsData.produtInfo.zjId + '、' + this.productsData.produtInfo.zjProBrand + '、' + this
					.productsData.produtInfo.zjProModel + '、' + this.productsData.produtInfo.zjTypeName + '、' + this
					.productsData.produtInfo.zjProItemNumber;
				this.productsData.procust = str;
				this.productsData.produtInfo.id = str;
				this.productsData.custAccId = this.custAccId
				console.log(this.productsData, '此时的productsData')
				this.submitproArr.push(this.productsData)
				console.log(this.submitproArr, 'submitarr')
				this.show = false;
				this.resetProductData()
			},
			// 查询用户
			async finduserphone(val) {
				const res = await uni.$api.work.finduserphone(this.custAccId, {
					val: val || ''
				})
				this.customlist = res.data
				console.log('finduserphone', res)
			},
			// 搜索客户
			searchcustom(e) {
				this.finduserphone(e.detail.value)
				console.log(e,'1')
			},
			// 获取用户信息
			async getcustom(item,index) {
				this.currindex=index
				console.log(item)
				let a = item.title.split(" ")
				console.log(a)
				this.customMes.name = a[0]
				this.customMes.phone = a[1]
				this.customMes.id = item.id

			},
			async saveCustom() {
				this.workUser.name = this.customMes.name
				this.workUser.phone = this.customMes.phone
				const res = await uni.$api.work.findinfobyid({
					id: this.customMes.id
				})
				console.log(res)
				this.show2 = false
			},
			// 查询工单分类
			// changeHandler(e) {

			// 	// debugger
			// 	const {
			// 		columnIndex,
			// 		value,
			// 		values, // values为当前变化列的数组内容
			// 		index,
			// 		// 微信小程序无法将picker实例传出来，只能通过ref操作
			// 		picker = this.$refs.uPicker
			// 	} = e
			// 	console.log(index, value, columnIndex, '切换工单')
			// 	// 当第一列值发生变化时，变化第二列(后一列)对应的选项
			// 	// if (columnIndex === 0) {
			// 	// 	// picker为选择器this实例，变化第二列对应的选项
			// 	// 	picker.setColumnValues(1, this.columnData[index])
			// 	// }
			// 	console.log(this.columnData, '421')
			// 	if (columnIndex === 0) {
			// 		this.findworkTypes(value[0].id)
			// 		setTimeout(() => {
			// 			console.log(this.columnData, '第二列111')
			// 			picker.setColumnValues(1, this.columnData)
			// 		}, 500)
			// 	}
			// },
			// 查询处理方式分类
			changeHandler2(e) {
				// debugger
				const {
					columnIndex,
					value,
					values, // values为当前变化列的数组内容
					index,
					// 微信小程序无法将picker实例传出来，只能通过ref操作
					picker = this.$refs.uPicker
				} = e
				console.log(index, value, columnIndex, '切换工单')
				// 当第一列值发生变化时，变化第二列(后一列)对应的选项
				// if (columnIndex === 0) {
				// 	// picker为选择器this实例，变化第二列对应的选项
				// 	picker.setColumnValues(1, this.columnData[index])
				// }
				console.log(this.columnData2, '421')
				if (columnIndex === 0) {
					this.findclfschild(value[0].id)
					setTimeout(() => {
						console.log(this.columnData2, '第二列111')
						picker.setColumnValues(1, this.columnData2)
					}, 500)
				}
			},
			// 回调参数为包含columnIndex、value、values

			confirm2(e) {
				// console.log('confirm2', e)
				// this.order.methodOneId=e.value[0].id
				// this.order.methodTwoId=e.value[1].id
				// this.order2.type=e.value[0].title + ','+ e.value[1].title
				this.order.methodOneId = this.clfs.oneId
				this.order.methodTwoId = this.clfs.twoId || ''
				
				if (this.clfs.oneClfs === '选择一级处理方式') {
					this.order2.clfstype = ''
				}else{
					this.order2.clfstype = this.clfs.oneClfs + ',' + this.clfs.twoClfs
					if(this.clfs.twoClfs==='暂无数据'){
						this.clfs.twoClfs=''
						this.order2.clfstype = this.clfs.oneClfs + ',' + this.clfs.twoClfs
					}
				}
				this.show4 = false
				console.log(this.order, 'this.order')
			},
			selectSlfs(item,index){
				console.log(item)
				this.accept=item.title
				this.currindex5=index
			},
			selectzbType(item,index){
				this.zbType=item.name
				this.currindex10=index
			},
			selectFwjb(item,index){
				console.log(item)
				this.fwjb=item.title
				this.currindex6=index
			},
			confirm3(e) {
				console.log('confirm3', e)
				this.order.accept = this.accept
				this.order2.accept=this.accept
				// this.order2.accept = e.value[0].title
				this.show5 = false
			},
			confirm4() {
				console.log('confirm4')
				this.order.serviceLevel =this.fwjb
				this.order2.serviceLevel =this.fwjb
				this.show6 = false
			},
			confirm5(e) {
				console.log('confirm5', e)
				const date = new Date(e.value);
				const year = date.getFullYear();
				const month = (date.getMonth() + 1).toString().padStart(2, '0');
				const day = date.getDate().toString().padStart(2, '0');
				const hours = date.getHours().toString().padStart(2, '0');
				const minutes = date.getMinutes().toString().padStart(2, '0');
				const seconds = date.getSeconds().toString().padStart(2, '0');
				const time = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
				this.order.createDate = time
				this.order2.createDate = time
				this.show7 = false
			},
			confirm6() {
				console.log('confirm6')
				this.order2.network = this.slwd
				this.order.networkId = this.slwdId
				this.show8 = false
			},
			confirm7() {
				this.order2.kfname = this.slkf
				this.order.acceptServiceId =this.slkfId
				this.show9 = false
			},
			// 第一列
			async findworkType() {
				const res = await uni.$api.work.findworkType({
					moduleId: this.moduleId
				})
				console.log(res, '592')
				if (res.code === 0) {
					// 这个就是  拿一级id查二级的那个方法
					this.defultcol = res.data;
					console.log('此时拿到第一列数据', this.defultcol)
					// if (arr.length > 0) {
					// 	let id = arr[0][0].id;
					// 	console.log('初始化id', id)
					// 	this.ordercateId = id;
					// 	this.findworkTypes(id)
					// }
				}
			},
			selectOne(item,index) {
				console.log(item,index)
				this.cateorize.oneCategorize = item.title
				this.cateorize.oneId = item.id
				this.findworkTypes(item.id)
				this.currindex2=index
			},
			// 第二列,这里
			async findworkTypes(id) {
				const res = await uni.$api.work.findworkTypes({
					parentid: id
				})
				// this.columns = a.map(obj => [obj])
				if(res.code===1){
					let arr = []
					arr.push({
						title:'暂无数据',
						id:''
					})
				this.columnData=arr
				}else{
					this.columnData = res.data
				}
				console.log(this.columnData, 'this.columnData')
			},
			selectTwo(item,index) {
				this.cateorize.twoCategorize = item.title
				this.cateorize.twoId = item.id
				this.currindex3=index
			},
			confirm() {
				this.order.typeOneId = this.cateorize.oneId
				this.order.typeTwoId = this.cateorize.twoId
				if (this.cateorize.oneCategorize === '选择一级分类') {
					this.order2.type = ''
					
				}else{
					this.order2.type = this.cateorize.oneCategorize + '-' + this.cateorize.twoCategorize
					if(this.cateorize.twoCategorize==='暂无数据'){
						this.cateorize.twoCategorize=''
						this.order2.type = this.cateorize.oneCategorize + ',' + this.cateorize.twoCategorize
					}
				}
				// if (this.columnData != undefined) {
				// 	this.order.typeOneId = this.cateorize.oneId
				// 	this.order.typeTwoId = this.cateorize.twoId
				// 	this.order2.type = this.cateorize.oneCategorize + ',' + this.cateorize.twoCategorize
				// } else {
				// 	// this.order.typeOneId = e.value[0].id
				// 	this.order.typeOneId = e.value[0] && e.value[0].length > 0 ? e.value[0].id : ''
				// 	this.order.typeTwoId = ''
				// 	// this.order2.type = e.value[0].title
				// 	this.order2.type = e.value[0] && e.value[0].length > 0 ? e.value[0].title : ''
				// }
				this.show3 = false
				console.log(this.order, 'this.order')
			},
			selectMesType(item,index){
				this.dxtz=item.name
				this.currindex10=index
			},
			// 查询处理方式
			async findclfs() {
				const res = await uni.$api.work.findclfs({
					moduleId: this.moduleId
				})
				console.log('查询处理方式', res.data)
				if (res.code === 0) {
					// 这个就是  拿一级id查二级的那个方法
					this.clfschildlist = res.data
				}
			},
			// 查询处理方式下级
			async findclfschild(id) {
				const res = await uni.$api.work.findclfschild({
					parentid: id
				})
				console.log(res)
				let coldate = []
				if (res.code === 0) {
					this.clfschildlist2 = res.data;
				} else {
					let arr = []
					arr.push({
						id: '',
						title: '暂无数据'
					})
					this.clfschildlist2 = arr
				}
			},
			selectOneClfs(item,index) {
				console.log(item)
				this.clfs.oneClfs = item.title
				this.findclfschild(item.id)
				this.currindex4=index
			},
			selectTwoClfs(item,index) {
				console.log(item)
				this.clfs.twoClfs = item.title || ''
				this.currindex5=index
			},
			saveClfs() {
				this.oneClfsShow = false
			},
			saveClfs2() {
				this.twoClfsShow = false
			},
			// 查询受理方式
			async acceptance() {
				const res = await uni.$api.work.acceptance({
					custAccId: this.custAccId
				})
				console.log('查询受理方式', res)
				this.acceptancelist = res.data
			},
			// 服务级别
			async serviceliver() {
				const res = await uni.$api.work.serviceliver({
					custAccId: this.custAccId
				})
				console.log('服务级别', res)
				this.fwjblist = res.data
			},
			// 查询受理网点
			async findnetworklist() {
				const res = await uni.$api.work.findnetworklist({
					type: this.type,
					custAccId: this.custAccId
				})
				this.networklist = res.data
				console.log(res, '查询受理网点')
			},
			// 查询受理客服
			async findemp() {
				const res = await uni.$api.work.findemp({
					custAccId: this.custAccId
				})
				console.log(res)
				this.emplist = res.data
			},
			// 时间格式化
			// formatter(type, value) {
			// 	console.log(value, '时间')
			// 	if (type === 'year') {
			// 		return `${value}年`
			// 	}
			// 	if (type === 'month') {
			// 		return `${value}月`
			// 	}
			// 	if (type === 'day') {
			// 		return `${value}日`
			// 	}
			// 	return value
			// },
			selectSlwd(item,index){
				console.log(item)
				this.slwdId=item.idVal
				this.slwd=item.nameVal
				this.currindex8=index
			},
			// 保存工单
			async saveorder() {
							// console.log(this.workUser, this.order, 'save')
							this.order.custAccId = this.custAccId
							this.order.id = this.workId
							this.order.moduleId = 38
							this.order.typeOneId = 373
							this.order.typeTwoId = 393
							this.order.methodOneId = 101
							let submitData = {
								workUser: {},
								order: this.order,
								products: this.submitproArr,
								address: {
									"province": this.userAddressArr[0],
									"city": this.userAddressArr[1],
									"area": this.userAddressArr[2],
									"town": this.userAddressArr[3],
									"address": this.workUser.detailAddress
								},
								customer: {
									"custAccId": "51",
									"id": "46565", //用户id
									"name": "",
									"phone": ""
								},
								workField: [],
								delCode:[]
								// fileList1
							}
							submitData.workUser = this.workUser;
							submitData.workUser.custAccId = this.custAccId; //商家id
							submitData.workUser.workId = this.workId
							// console.log(products, '提交产品部分')
							// console.log(this.zdyimglist, '自定义上传图片处理后')
							console.log(this.zdylist, '自定义部分')
			
							let data = this.zdylist;
							//处理自定义
							for (let i = 0; i < data.length; i++) {
								 let obj = {
									"fieldKey": data[i].fieldKey,
									"fieldValue": "",
									"moduleFieldId": data[i].moduleId,
									"isScreeningConditions": data[i].isScreeningConditions,
									"isListShow": data[i].isListShow,
									"fieldType": data[i].fieldType,
									"isMust": false,
									"id": data[i].id,
									"type": null,
									"valueJson": '',
									"custAccId": this.custAccId,
									"moduleFieldId":177850
								}
								// 1：文本，2：多图，3：单选，4：多选'
								if (data[i].fieldType == '文本') {
									obj.type = 1;
									obj.fieldValue = data[i].fieldValue;
								}
								if (data[i].fieldType == '多图') {
									obj.type = 2;
									let imgval = this.zdyimglist.toString()
									obj.fieldValue = imgval;
								}
								if (data[i].fieldType == '单选') {
									obj.type = 3;
									obj.fieldValue = data[i].fieldValue;
									obj.valueJson = data[i].content.value.toString()
								}
								if (data[i].fieldType == '多选') {
									obj.type = 4;
									obj.fieldValue = data[i].fieldValueArr.toString();
									obj.valueJson = data[i].content.value.toString()
								}
								submitData.workField.push(obj)
							}
							submitData.products.forEach((item) => {
								item.userAddress = JSON.stringify({
									"province": this.userAddressArr[0],
									"city": this.userAddressArr[1],
									"area": this.userAddressArr[2],
									"town": this.userAddressArr[3],
									"address": this.workUser.detailAddress
								})
							})
							// console.log('最终提交的workField', workField.workField)
							console.log('最终提交的总数据', submitData)
							let dataObj = {
								acId: uni.getStorageSync('acId'),
								noteDx: 0,
								isMobileRemark: true,
								files:this.fileList1,
								json: JSON.stringify(submitData)
							}
							const res = await uni.$api.work.saveOrder(dataObj)
							console.log(res, "res")
						}
		}
	}
</script>

<style lang="scss" scoped>
	/deep/.u-navbar--fixed {
		position: static !important;
	}
	/deep/.u-radio-group--row {
		justify-content: flex-end;
	}
	
	.isActive2 {
		color: #fd7400;
	
	}
	.addorder {
		padding: 20rpx 20rpx 0;
		background-color: #f5f5f5;
		
		.addorder-content {
			
		}
		
		.addorder-content-item {
			background: #fff;
			margin-bottom: 20rpx;
			border-radius: 10rpx;
				
			.addorder-item-title {
				padding: 20rpx;
				font-size: 30rpx;
			}
		}
		
		
		
		.product {

			.img {
				img {
					width: 120rpx;
					height: 120rpx;
				}
			}
		}

		.save-btn {
			height: 50px !important;
			// boxShadow: '0 7px 40px rgba(235 151 43 / 30%)',
			background: linear-gradient(90deg, rgba(253, 116, 0, 1) 0%, rgba(255, 87, 51, 1) 100%);
			border: 0;
			boxShadow: 0px 7px 40px  rgba(253, 112, 8, 0.2);
			borderRadius: 8px;
			fontSize:18px;
			color:#fff
		}

		.addproduct {
			width: 45%;
			height: 35px;
			margin: 10px auto;
			border: 1px dashed #fd7400;
			line-height: 35px;
			background-color: #fff1e5;
			text-align: center;
		}

		.list-item {
			border-top: solid 1px #f6f6f6;
			line-height: 1.75;
			margin-left: 10px;
			padding: 3px 5px;
		}

		.remove-btn {
			background-color: #f96868;
			height: 62rpx;
			font-size: 16rpx;
			padding: 0 24rpx;
			color: $uni-text-color-inverse;
			line-height: 62rpx;
			border-radius: 8rpx;
		}
	}

	.address-color {
		color: #505050;
	}

	.popup-v {
		// background: #fff;
		// height: calc(100vh - env(safe-area-inset-bottom));
		height: calc(95vh - env(safe-area-inset-bottom));

		.popup-header {
			padding: 30rpx 60rpx;
			display: flex;
			justify-content: center;

			.close {
				width:
					40rpx;
			}

			.title {
				font-size: 36rpx;
				font-weight: 700;
				width: 100%;
				text-align: center;
			}
		}

		.edit-form {
			padding: 0 60rpx;

			.form-item {
				background-color: #fff;
				justify-content: space-between;
				padding: 30rpx;
				margin-bottom: 30rpx;
				text-align: right;
				border: 1px solid #f5f5f5;
				border-radius: 8rpx;
			}
		}

		.popup-c {
			max-height: 100%;
			overflow: auto;

			.popup-content {
				padding: 0 60rpx 60rpx 60rpx;

				.title {
					margin-bottom: 30rpx;
					border-left: 6rpx solid #fd7400;
					padding: 0 10rpx;

				}

				.tagA {
					text-align: center;
					padding: 20rpx 0;
					margin-bottom: 30rpx;
					border-radius: 8rpx;
					background-color: #f5f5f5;
				}
			}

			.footer {
				padding: 60rpx;
				width: 100%;
				justify-content: space-between;
				position: fixed;
				bottom: 0;
				background-color: #fff;
				margin-top: 60rpx
			}
		}
	}
</style>